// components/musicList/musicList.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    musicList: {
      type: Array
    }
  },
  pageLifetimes:{
    show(){
      this.setData({
        playingId:app.getPlayingMusicId()
      })
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    playingIndex:-1
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onSelectMusic(event) {
      // event是事件对象
      // console.log(event);
      this.setData({
        playingId: event.currentTarget.dataset.musicId
      })
      wx.navigateTo({
        url: `/pages/player/player?musicId=${event.currentTarget.dataset.musicId}&index=${event.currentTarget.dataset.index}`
      });
        
    }
  }
})
